<template>
	<view v-if="pageShow">
		<view class="block">
			<view class="xiaobai ershiba">账户余额</view>
			<view class="xiaobai fonweight margin_top2" style="font-size: 60rpx;">{{userInfo.score}}
				<text class="xiaobai titletext">个</text>
			</view>
		</view>
		<view class="mainpadding ffffff block2">
			<view class="titletext fonweight zhonghei">充值</view>
			<input class="input margin_top" placeholder="自定义充值个数" type="number" v-model="pay_price"/>
		</view>
		<view class="gudingdb mainpadding flexbetween">
			<view class="czbtn flexcenter" @click="tzczj">充值记录</view>
			<view class="ljcz flexcenter" @click="chongzhi()">立即充值</view>
		</view>
	</view>
</template>
<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				userInfo: {},
				pageShow: false,
				pay_price:""
			}
		},
		onShow() {
			this.userinfomsg()
		},
		methods: {
			userinfomsg() {
				httpRequest.request('/api/user/index', 'GET', {}).then(res => {
					this.userInfo = res.data
					this.pageShow = true
				})
			},
			// 跳转充值记录
			tzczj() {
				uni.navigateTo({
					url: '/pages_mypage/chongzhijil'
				})
			},
			chongzhi(){
				if(this.pay_price==""){
					httpRequest.toast("请输入充值金额")
					return false
				}
				let data = {
					pay_price:this.pay_price,
					type:3,
					order_id:""
				}
				uni.navigateTo({
					url:"/pages_index/zhifu?msg="+encodeURIComponent(JSON.stringify(data))
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.ljcz {
		width: 328rpx;
		height: 76rpx;
		font-size: 26rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 800;
		background-color: #FF7510;
		border: 2rpx solid #FF7510;
		border-radius: 6rpx;
		color: #FFFFFF;
	}

	.czbtn {
		width: 328rpx;
		height: 76rpx;
		font-size: 26rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 800;
		background-color: #fff2e8;
		border: 2rpx solid #FF7510;
		border-radius: 6rpx;
		color: #FF7510;
	}

	.input {
		background: #F6F6F6;
		border-radius: 6rpx 6rpx 6rpx 6rpx;
		padding: 30rpx;
	}

	.block2 {
		border-radius: 16rpx 16rpx 0 0;
		position: relative;
		top: -20rpx;
	}

	.block {
		padding: 40rpx 30rpx 40rpx;
		background-color: #ff7510;
	}
</style>